It gives me error message that i used. Its first time i use const char *file, what is wrong? I have file in same folder as program.
Code:
int readStudentsFile(const char *file, Student Table[], int N)
{
int i;
Student newStudent;
FILE *f;
f = fopen(file, "r");
if(f == NULL)
{
return -1; // error
}
while(!feof(f))
{
fscanf(f, "%d\n", &newStudent.num);
}
fclose(f);
return 1;
int main()
{
int k, Size=50, num, pos, fileIsOkay;
char file[20];
Student *newStudent;
HASH *HashTable;
printf("Read file? (0 = no, 1 = yes) ");
scanf("%d", &k);
if(k==1)
{
fileIsOkay = readStudentsFile("data.txt", HashTable, Size);
if(fileIsOkay == -1)
{
printf("Error opening file \n");
}
}